/* GSSelectConidManfacture.java
 *
 * Project/Product: JZCG-XMBUS
 *
 * Modify Information:
 * =============================================================================
 *   Author	Date       Description
 *   ----------	---------- ---------------------------------------------------
 *   peng.ning	2008-10-17	First release
 *
 * Licensed Materials - Property of APEP
 * =============================================================================
 *    (C) COPYRIGHT Shanghai Auto Mart E-Procurement Co., Ltd. 2007 - 2008
 *    All Rights Reserved.
 *
 *    This software is the confidential and proprietary information of
 *    Shanghai Auto Mart E-Procurement Co., Ltd. ("Confidential Information").
 *    You shall not disclose such Confidential Information and shall use it only
 *    in accordance with the terms of the license agreement you entered into 
 *    with Shanghai Auto Mart E-Procurement Co., Ltd.
 *
 * Noties:
 * =============================================================================
 * 
 */

package com.hitrust.gs.action;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSManufactureBean;
import com.hitrust.gs.bean.GSManufactureCategoryBean;
import com.hitrust.gs.business.GSManufactureCategoryProcessor;
import com.hitrust.gs.business.GSManufactureProcessor;
import com.hitrust.gs.business.GSProviderProcessor;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

public class GSSelectConidManfacture extends GSBaseAction {

    /* (non-Javadoc)
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        // TODO Auto-generated method stub
        GSManufactureProcessor mpro=new GSManufactureProcessor();
        GSProviderProcessor ppro=new GSProviderProcessor();
        String sid=aForm.getRequest().getParameter("cid");
        ArrayList al=mpro.getManufacutreByConcentricityId(sid);
        String proname="";
        for (int i = 0; i < al.size(); i++) {
            GSManufactureBean mb=(GSManufactureBean) al.get(i);
            proname=ppro.getProviderById(mb.getGs_provider_id()).getGs_provider_name();
            mb.setGs_provider_name(proname);
            GSManufactureCategoryBean cbean=GSManufactureCategoryProcessor.getCategory(mb.getGs_manufacture_category_id());
            String str="";
            if ("1".equals(cbean.getGs_manufacture_level())) {
                str=cbean.getGs_manufacture_category_id();
            }else if ("2".equals(cbean.getGs_manufacture_level())) {
                str=cbean.getGs_manufacture_category_id1()+"%"+cbean.getGs_manufacture_category_id();
            }else if ("3".equals(cbean.getGs_manufacture_level())) {
                str=cbean.getGs_manufacture_category_id1()+"%"+cbean.getGs_manufacture_category_id2()+"%"+cbean.getGs_manufacture_category_id();
            }
            mb.setGs_manufacture_category_name(cbean.getGs_manufacture_category_name());
            mb.setGs_manufacture_category_desc(str);
        }
        aForm.getRequest().setAttribute("mal", al);
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
